/**this app is used to test the function of errno
include: global variable errno
funciton strerror, perror*/
#include<errno.h>
#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

int main(void)
{
	int fd;
	//when include errno.h, u can use the variable errno
	printf("errno=%d\n",errno);
	fd=open("./test.txt",O_RDONLY);
	if(-1==fd){
		printf("errno=%d\n",errno);
		printf("strerror=%s\n",strerror(errno));
		perror("");
		perror("open error");
		return 1;
	}
	return 0;
}
